//
//  MaterialFreeTableViewCell.m
//  SsehMaster
//
//  Created by 杨阳 on 2018/8/12.
//  Copyright © 2018年 yinlong. All rights reserved.
//

#import "MaterialFreeTableViewCell.h"
#import "SelectdMateralModel.h"

@interface MaterialFreeTableViewCell()

@property (weak, nonatomic) IBOutlet UILabel *leftLabel;

@property (nonatomic,strong) NSIndexPath * index;

@end

@implementation MaterialFreeTableViewCell


- (void)awakeFromNib {
    [super awakeFromNib];
    
    UITapGestureRecognizer * leftLabelTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(leftLabelClick:)];
    
    [self.leftLabel addGestureRecognizer:leftLabelTap];
    
}

-(void)leftLabelClick:(UIGestureRecognizer *)tap{
    
    if (_leftLabelComplete) {
        _leftLabelComplete(self.index);
    }
    
}


- (IBAction)rightTFEndEditing:(id)sender {
    
    if (_rightTFComplete) {
        _rightTFComplete(self.rightTF.text,self.index);
    }
    
    
}

-(void)configData:(SelectdMateralModel *)model andIndex:(NSIndexPath *)index{
    
    self.index = index;
    self.leftLabel.text = model.material_name;
    self.rightTF.text = model.material_count;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
